<template>
  <button @click="eventBus.emit('brother', '我是brother1组件')">按钮</button>
  <div>我是兄弟组件1</div>
  <span>{{ number }}</span>
  <div
    @click="
      qas++;
      number++;
    "
  >
    {{ qas }}
  </div>
  <brother3 :qer="qer" @tems="tems"></brother3>
  {{ wer }}=50
</template>

<script setup>
import brother3 from "./brother3.vue";
// mitt就是vue2中的eventBus用于兄弟组件传值
import { ref, inject, reactive } from "vue";
const eventBus = inject("eventBus");
const number = ref(1);
let wer = reactive({ value: 20 });
eventBus.on("brothers", (val) => {
  number.value = val;
});
let qer = 68;
const tems = () => {
  console.log(wer.value);
};
// eventBus.on("wwww", (val) => {
//   alert(val);
// });
let qas = 190;
</script>

<style scoped></style>
